package entity;

import java.util.Date;

import javax.annotation.Resource;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import config.SystemConfig;
import config.SystemConfigBean;

@Entity
@Table(name="paper")
public class Paper {
	
	private static final SystemConfig config = SystemConfigBean.getInstance();
	
	public static final int STATUS_FILE_ERR = -1;
	
	public static final int STATUS_0_UPLOADED_WAIT_FOR_REVIEW = 0;
	
	public static final int STATUS_1_REVIEWING = 1;
	
	public static final int STATUS_2_REVIEW_PASSED_PAY = 2;
	
	public static final int STATUS_3_REVIEW_FAILED = 3;
	
	public static final int STATUS_4_PAYED_WAIT_CONFIRM_RECEIVE =4;
	
	public static final int STATUS_5_RECEIVED_AND_COMPLETED = 5;
	
	public static final int STATUS_6_PAY_TIME_OUT = 6;
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
    private int id;
	
	@Column(name="userId")
    private int userId;
	
	@Column(name="chineseTitle", length=50)
    private String chineseTitle;	
	
	@Column(name="englishTitle", length=100)
    private String englishTitle;
	
	@Column(name="pageCount")
    private int pageCount;
	
	@Column(name="forYear")
    private int forYear;
	
	@Column(name="topicId")
    private int topicId;
	
	@Column(name="status")
    private int status;
	
	@Column(name="submitTime")
    private Date submitTime;
	
	@Column(name="updateTime")
    private Date updateTime;
	
	@Column(name="firstAuthor", length=20)
    private String firstAuthor;
	
	@Column(name="firstAuthorEn", length=20)
    private String firstAuthorEn;
	
	@Column(name="firstEmail", length=50)
    private String firstEmail;
	
	@Column(name="secondAuthor", length=20)
    private String secondAuthor;
	
	@Column(name="thirdAuthor", length=20)
    private String thirdAuthor;
	
	@Column(name="demo", length=255)
    private String demo;

	@Column(name="filePath", length=50)
	private String filePath;
	
	@Column(columnDefinition="char(32)")
	private String md5;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getChineseTitle() {
		return chineseTitle;
	}

	public void setChineseTitle(String chineseTitle) {
		this.chineseTitle = chineseTitle;
	}

	public String getEnglishTitle() {
		return englishTitle;
	}

	public void setEnglishTitle(String englishTitle) {
		this.englishTitle = englishTitle;
	}

	public int getPageCount() {
		return pageCount;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public int getForYear() {
		return forYear;
	}

	public void setForYear(int forYear) {
		this.forYear = forYear;
	}

	public int getTopicId() {
		return topicId;
	}

	public void setTopicId(int topicId) {
		this.topicId = topicId;
	}

	public int getStatus() {
		return status;
	}
	
	public String getStatusValue() {
		
		return config.getStatus().get(status);
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Date getSubmitTime() {
		return submitTime;
	}

	public void setSubmitTime(Date submitTime) {
		this.submitTime = submitTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getFirstAuthor() {
		return firstAuthor;
	}

	public void setFirstAuthor(String firstAuthor) {
		this.firstAuthor = firstAuthor;
	}

	public String getFirstAuthorEn() {
		return firstAuthorEn;
	}

	public void setFirstAuthorEn(String firstAuthorEn) {
		this.firstAuthorEn = firstAuthorEn;
	}

	public String getFirstEmail() {
		return firstEmail;
	}

	public void setFirstEmail(String firstEmail) {
		this.firstEmail = firstEmail;
	}

	public String getSecondAuthor() {
		return secondAuthor;
	}

	public void setSecondAuthor(String secondAuthor) {
		this.secondAuthor = secondAuthor;
	}

	public String getThirdAuthor() {
		return thirdAuthor;
	}

	public void setThirdAuthor(String thirdAuthor) {
		this.thirdAuthor = thirdAuthor;
	}

	public String getDemo() {
		return demo;
	}

	public void setDemo(String demo) {
		this.demo = demo;
	}

	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public String getMd5() {
		return md5;
	}

	public void setMd5(String md5) {
		this.md5 = md5;
	}
	
	
}
